Timespan conversion
От | Herouth Maoz |
---|---|
Тема | Timespan conversion |
Дата | |
Msg-id | l03110703b233e2cdd004@[147.233.159.109] обсуждение исходный текст |
Список | pgsql-sql |
I currently run Postgres 6.2.1. I wanted to use it to compute my basketball statistics (the classical relational database application) - enter the rows from the box scores, and get all sorts of statistics. My question relates to the 'minutes played' column. The natural implementation is timespan, because I get times in mm:ss format. Timespans sum up nicely. The problem begins in calculations such as "average minutes per game", "minutes between rebounds", etc. There is no problem in converting timespans to float. I just take the date_part( 'epoch', timespan_field ), and divide it by, say, 60. My problem is, after I divide this by the number of games, how do I convert back to timespan? Also, is there a way to receive '20:30' or maybe '00:20:30' and not '20 minutes 30 seconds' as a display from timespan? I don't want to build an application for all this, because, frankly, it's just a hobby. Most of the work can be done rather well in simplest SQL. Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma
В списке pgsql-sql по дате отправления: